<?php
session_start();
include_once 'functions/function.php';
include_once 'functions/index.class.php';
include_once 'functions/newReply.class.php';

$Db = Db();


if(!isset($_SESSION['id'])){
    
     
    session_start();
    session_unset();
    session_destroy();

    header('Location: index.php');
}



?>




<!DOCTYPE html>
<html>
    <head>
		<link rel="stylesheet" href="css/adminHome.css">
	</head >
	
	
	<body style="background: url(images/background.jpg);">
	
	
		<div id="wrapper">
		
			<div id="head">
		
					<table id="myTable" border=0>
						<tr>
							<td class="leftCell" ><span>Hello!!<span class="newAccount"><?php echo $_SESSION['username']; ?></a></span></td>
							<td class="middleCell" ><a class="newAccount" href="adminHome.php">Home</a></td>
							<td class="rightCell" ><span><a class="newAccount" href="logOut.php">Sign out</a></span></td>
						</tr>
					</table>
		
            </div>
	
		<div id="container">
		
		
			<div id="optionSection">
                            <table border="0" id="adminHeader">
                                
                                <tr class="newForum">
                                    <td class="left"><a class="noDecoration4" href="#">Create New Forum</a></td>
                                    <td class="right"><a class="noDecoration4" href="#">Manage Users</a></td>
                                </tr>
                                
                            </table>
			</div>
                    
                    
                    
                            <div id="myTable2">
			
				<div id="forumSection">
				
                                    
                                    <?php
                                         $query = $Db->query('SELECT *FROM user');
                                         
                                         $count = 1;
                                         
                                         ?>
                                        
                                    <h3 class="noDecoration" align="center">List Of Users</h3>
                                       <table border="0" id="tableUser">
                                        
                                           <tr>
                                               <td class="emailHeader">Email</td>
                                               <td class="userHeader">Username</td>
                                               <td class="lastHeader">Last Name</td>
                                               <td class="firstHeader">First Name</td>
                                               <td class="roleHeader">Role</td>
                                               <td class="banHeader">Banned</td>
                                           </tr>
                                         <?php
                                            
                                         while( $response = $query->fetch()){
                                                
                                            if($count==1){
                                               
                                                $count = 0;
                                            }
                                            else{
                                                
                                                $count = 1;
                                            }
                                          ?>
                                            
                                             
                                                
                                           <!--<tr class='cells'><td class="forum"> -->
                                           <tr class='cells<?=$count?>'>
                                                 
                                           <td class="email">
                                               <p><a class="noDecoration" href="modifyUser.php?email=<?php echo $response['email'];?>"><?php echo $response['email'];?></a>
                                               <br><span class="subs"> Joined : <?php  echo $response['dateCreated']; ?></p></td>
                                           
                                           <td class="user"><?php echo $response['username'];?></td>
                                           <td class="last"><?php echo $response['lastName'];?></td>
                                           <td class="first"><?php echo $response['firstName'];?></td>
                                               <td class="role"><p><?php echo $response['role'];?></p></td>
                                               <td class="ban"><p> <?php if($response['isBanned']=="f"){echo "No";} else{echo "Yes";}?></p></td>
                                           </tr>
                                                
                                      
                                  
                                            
                                            <?php
                                         }
                                         
                                         ?>
                                         
                                         </table>
                                                
                                           
                                
                                
                                     <br class="clear" />                                  
                                </div>
                                  
                                    
                                    
                                         
		
                                 
                               
                                
                                
                                <br class="clear" />         
			</div>
	
                    <br class="clear" />
		</div>
		
		<br class="clear" />
		</div>
		<br class="clear" />
                </div>	
	
	</body>
</html>
 
                                      


